/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package net.metashare.grah

import net.metashare.grah.logic.Predicate
import net.metashare.grah.logic.True
import net.metashare.grah.meta.MetaContext

/**
 *
 * @author dsherema
 */
class CompoundGraph implements Graph {

  def List graphs = []

  def add(Graph g) {graphs.add(g)}

  def remove(Graph g) {graphs.remove(g)}

  def boolean contains(Graph g) {return graphs.contains(g)}

  def List nodes(Predicate p = True.instance) {
    List list = []
    graphs.each().nodes().each() { if (p.apply(it)) list.add(it) }
    return list
  }

  def List<Edge> edges(Predicate p = True.instance) {
    List<Edge> list = []
    graphs.each().edges().each() { if (p.apply(it)) list.add(it) }
    return list
  }

  def MetaContext context() {

  }


}

